package com.objecteffects.ilmp.tumblr.method;

import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * @author Rusty Wright
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Blog {
    private final String title;
    private final int posts;
    private final String name;
    private final String url;
    private final int updated;
    private final String description;
    private final Boolean ask;
    private final Boolean askAnon;
    private final int likes;
    private final int totalUsers;
    private final Boolean nsfw;
    private final String askPageTitle;
    private final Boolean followed;
    private final Boolean canSendFanMail;
    private final Boolean shareLikes;
    private final Boolean twitterEnabled;
    private final Boolean twitterSend;
    private final String facebookOpengraphEnabled;
    private final String tweet;
    private final String facebook;
    private final int followers;
    private final Boolean primary;
    private final Boolean admin;
    private final int messages;
    private final int queue;
    private final int drafts;
    private final String type;

    public Blog(@JsonProperty("title")
    final String _title, @JsonProperty("posts")
    final int _posts, @JsonProperty("name")
    final String _name, @JsonProperty("url")
    final String _url, @JsonProperty("updated")
    final int _updated, @JsonProperty("description")
    final String _description, @JsonProperty("ask")
    final Boolean _ask, @JsonProperty("ask_anon")
    final Boolean _askAnon, @JsonProperty("likes")
    final int _likes, @JsonProperty("total_users")
    final int _totalUsers, @JsonProperty("is_nsfw")
    final Boolean _nsfw, @JsonProperty("ask_page_title")
    final String _askPageTitle, @JsonProperty("followed")
    final Boolean _followed, @JsonProperty("can_send_fan_mail")
    final Boolean _canSendFanMail, @JsonProperty("share_likes")
    final Boolean _shareLikes, @JsonProperty("twitter_enabled")
    final Boolean _twitterEnabled, @JsonProperty("twitter_send")
    final Boolean _twitterSend, @JsonProperty("facebook_opengraph_enabled")
    final String _facebookOpengraphEnabled, @JsonProperty("tweet")
    final String _tweet, @JsonProperty("facebook")
    final String _facebook, @JsonProperty("followers")
    final int _followers, @JsonProperty("primary")
    final Boolean _primary, @JsonProperty("admin")
    final Boolean _admin, @JsonProperty("messages")
    final int _messages, @JsonProperty("queue")
    final int _queue, @JsonProperty("drafts")
    final int _drafts, @JsonProperty("type")
    final String _type) {
        super();
        this.title = StringUtils.defaultIfBlank(_title, "");
        this.posts = _posts;
        this.name = StringUtils.defaultIfBlank(_name, "");
        this.url = StringUtils.defaultIfBlank(_url, "");
        this.updated = _updated;
        this.description =
            StringEscapeUtils.escapeHtml4(StringUtils
                                          .defaultIfBlank(_description, ""));
        this.ask = _ask;
        this.askAnon = _askAnon;
        this.likes = _likes;
        this.totalUsers = _totalUsers;
        this.nsfw = _nsfw;
        this.askPageTitle = StringUtils.defaultIfBlank(_askPageTitle, "");
        this.followed = _followed;
        this.canSendFanMail = _canSendFanMail;
        this.shareLikes = _shareLikes;
        this.twitterEnabled = _twitterEnabled;
        this.twitterSend = _twitterSend;
        this.facebookOpengraphEnabled =
            StringUtils.defaultIfBlank(_facebookOpengraphEnabled, "");
        this.tweet = StringUtils.defaultIfBlank(_tweet, "");
        this.facebook = StringUtils.defaultIfBlank(_facebook, "");
        this.followers = _followers;
        this.primary = _primary;
        this.admin = _admin;
        this.messages = _messages;
        this.queue = _queue;
        this.drafts = _drafts;
        this.type = StringUtils.defaultIfBlank(_type, "");
    }

    // @JsonIgnore
    private final Map<String, Object> additionalProperties = new HashMap<>();

    @JsonProperty("title")
    public String getTitle() {
        return this.title;
    }

    @JsonProperty("posts")
    public int getPosts() {
        return this.posts;
    }

    @JsonProperty("name")
    public String getName() {
        return this.name;
    }

    @JsonProperty("url")
    public String getUrl() {
        return this.url;
    }

    @JsonProperty("updated")
    public int getUpdated() {
        return this.updated;
    }

    @JsonProperty("description")
    public String getDescription() {
        return this.description;
    }

    @JsonProperty("ask")
    public Boolean isAsk() {
        return this.ask;
    }

    @JsonProperty("ask_anon")
    public Boolean isAskAnon() {
        return this.askAnon;
    }

    @JsonProperty("likes")
    public int getLikes() {
        return this.likes;
    }

    @JsonProperty("total_users")
    public int getTotalUsers() {
        return this.totalUsers;
    }

    /**
     * @return the nsfw
     */
    public Boolean isNsfw() {
        return this.nsfw;
    }

    /**
     * @return the askPageTitle
     */
    public String getAskPageTitle() {
        return this.askPageTitle;
    }

    /**
     * @return the followed
     */
    public Boolean isFollowed() {
        return this.followed;
    }

    /**
     * @return the canSendFanMail
     */
    public Boolean isCanSendFanMail() {
        return this.canSendFanMail;
    }

    /**
     * @return the shareLikes
     */
    public Boolean isShareLikes() {
        return this.shareLikes;
    }

    /**
     * @return the twitterEnabled
     */
    public Boolean isTwitterEnabled() {
        return this.twitterEnabled;
    }

    /**
     * @return the twitterSend
     */
    public Boolean isTwitterSend() {
        return this.twitterSend;
    }

    /**
     * @return the facebookOpengraphEnabled
     */
    public String getFacebookOpengraphEnabled() {
        return this.facebookOpengraphEnabled;
    }

    /**
     * @return the tweet
     */
    public String getTweet() {
        return this.tweet;
    }

    /**
     * @return the facebook
     */
    public String getFacebook() {
        return this.facebook;
    }

    /**
     * @return the followers
     */
    public int getFollowers() {
        return this.followers;
    }

    /**
     * @return the primary
     */
    public Boolean isPrimary() {
        return this.primary;
    }

    /**
     * @return the admin
     */
    public Boolean isAdmin() {
        return this.admin;
    }

    /**
     * @return the messages
     */
    public int getMessages() {
        return this.messages;
    }

    /**
     * @return the queue
     */
    public int getQueue() {
        return this.queue;
    }

    /**
     * @return the drafts
     */
    public int getDrafts() {
        return this.drafts;
    }

    /**
     * @return the type
     */
    public String getType() {
        return StringUtils.defaultIfBlank(this.type, "");
    }

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(final String _name, final Object value) {
        this.additionalProperties.put(_name, value);
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    @Override
    public boolean equals(final Object other) {
        return EqualsBuilder.reflectionEquals(this, other);
    }
}
